# -*- coding: UTF-8 -*-
"""
@Project ：swift-forge-engine 
@File    ：generate_string
@IDE     ：PyCharm 
@Author  ：Tony
@Date    ：2025/2/19 14:19 
@Des     ：
"""
import hashlib
import uuid
import datetime


def get_uuid4_str() -> str:
    """
    获取 uuid4 字符串
    :return: str(uuid)
    """
    return str(uuid.uuid4())


def get_current_timestamp() -> float:
    """
    获取当前时间戳
    :return:
    """
    return datetime.datetime.now().timestamp()


def get_day_str(offset: int = 0) -> str:
    """
    生成日期字符串
    :param offset:
    :return:
    """
    today = datetime.datetime.now()
    target_date = today + datetime.timedelta(days=offset)
    return target_date.strftime("%Y%m%d")


def random_str() -> str:
    """
    唯一随机字符串
    :return: str 用于唯一字符串
    """
    only = hashlib.md5(str(uuid.uuid1()).encode(encoding='UTF-8')).hexdigest()
    return str(only)


def get_fill_num(num: int, length: int = 5) -> str:
    """
    填充字符串到指定长度
    :return: str 填充字符串
    """
    num_str = str(num).zfill(length)
    return num_str